home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / FPGAWKII.ZIP / ADDMODUL.PDS < prev    next >
Text File  |  1994-10-05  |  2KB  |  58 lines

  1. ;---------------------------------------------------------
  2. ; This defines a 1-bit full-adder and an 8-bit adder built
  3. ; using the full-adder.  The modules in this file can be
  4. ; used with other PLDASM files if an adder is ever needed.
  5. ;---------------------------------------------------------
  6. TITLE   8-bit adder
  7.  
  8.  
  9. ;---------------------------------------------------------
  10. ;*-- beginning of 1-bit adder module ---------------------
  11. ;---------------------------------------------------------
  12. DEFMOD fulladd( a, b, cin, sum, cout )
  13. CHIP    fulladd         Intel_arch
  14.  
  15. PIN     a       ;* one of the bits to be added
  16. PIN     b       ;* the other bit to be added
  17. PIN     cin     ;* the carry input from the previous stage
  18. PIN     sum     ;* the 1-bit sum of a+b+c
  19. PIN     cout    ;* the carry output to the next stage
  20.  
  21. T_TAB( a b cin >> sum cout )
  22.        0 0 0   :  0   0
  23.        0 1 0   :  1   0
  24.        1 0 0   :  1   0
  25.        1 1 0   :  0   1
  26.        0 0 1   :  1   0
  27.        0 1 1   :  0   1
  28.        1 0 1   :  0   1
  29.        1 1 1   :  1   1
  30. ENDMOD
  31. ;*-- end of 1-bit adder module ---------------------------
  32.  
  33.  
  34. ;---------------------------------------------------------
  35. ;*-- beginning of 8-bit adder module ---------------------
  36. ;---------------------------------------------------------
  37. DEFMOD add8( a[0:7], b[0:7], cin, sum[0:7], cout )
  38. CHIP    add8      Intel_arch
  39.  
  40. PIN     a[0:7]    ;* one of the 8-bit inputs to be added
  41. PIN     b[0:7]    ;* add this 8-bit input to the first
  42. PIN     cin       ;* carry input (for cascaded adders)
  43. PIN     sum[0:7]  ;* sum of a[0:7]+b[0:7]+cin
  44. PIN     cout      ;* carry output (for cascading adders)
  45. PIN     cry[0:6]  ;* pins for holding the carry bits
  46.                   ;* from the 1-bit adders
  47.  
  48. MODULE fulladd( a=a0,b=b0,cin=cin,  sum=sum0,cout=cry0)
  49. MODULE fulladd( a=a1,b=b1,cin=cry0, sum=sum1,cout=cry1)
  50. MODULE fulladd( a=a2,b=b2,cin=cry1, sum=sum2,cout=cry2)
  51. MODULE fulladd( a=a3,b=b3,cin=cry2, sum=sum3,cout=cry3)
  52. MODULE fulladd( a=a4,b=b4,cin=cry3, sum=sum4,cout=cry4)
  53. MODULE fulladd( a=a5,b=b5,cin=cry4, sum=sum5,cout=cry5)
  54. MODULE fulladd( a=a6,b=b6,cin=cry5, sum=sum6,cout=cry6)
  55. MODULE fulladd( a=a7,b=b7,cin=cry6, sum=sum7,cout=cout)
  56. ENDMOD
  57. ;*-- end of 8-bit adder module --------------------------
  58.